package com.promise.jokerdream.config.game

import kotlinx.serialization.Serializable

@Serializable
data class AbyssGameConfig(
    override val enabledSetting: Boolean = false,
    override val scheduledChallengeEnabled: Boolean = false,
    override val registrationTime: String = "",
    // 许愿点相关
    val wishPointsEnabled: Boolean = false,
    // 兑换次数相关
    val exchangeTimesEnabled: Boolean = false,
    // 挑战相关
    val challengeEnabled: Boolean = false,
    val reviveEnabled: Boolean = false,
    val selectedAbyssText: String = "1-崎岖斗界",
): BaseGameConfig {
    
    /**
     * 获取深渊ID
     * 支持格式：1-崎岖斗界 或 纯数字
     * @return 深渊ID，如果解析失败返回null
     */
    fun getSelectedAbyssId(): Int? {
        return if (selectedAbyssText.contains("-")) {
            selectedAbyssText.split("-").firstOrNull()?.toIntOrNull()
        } else {
            selectedAbyssText.toIntOrNull()
        }
    }
}
